<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $main_uid 
 * @property string $name 任务名称
 * @property int $corp_id 企业ID
 * @property int $group_id 分组id
 * @property array $robot_ids 机器人ID
 * @property int $send_interval 发送间隔
 * @property array $contact_data 客户数据
 * @property array $send_content 发送内容
 * @property int $send_time_type 发送类型：0=立即发送 1=定时发送
 * @property int $send_time 定时发送时间
 * @property array $send_time_config 发送配置
 * @property array $comments 评论内容
 * @property int $timing_delete_switch 定时删除开关：0=关 1=开
 * @property string $timing_delete_hour 定时删除时间 多少小时
 * @property int $is_cust_dedup 客户去重：0=否 1=是
 * @property int $status 状态：0=创建中 1=待发布 2=待执行 3=已完成 4=已取消
 * @property int $publish_time 发布时间
 * @property array $exception_data 异常信息
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property-read null|ChUser $user 
 * @property-read null|ChFriendCircleTaskGroup $group 
 */
class ChFriendCircleTask extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_friend_circle_task';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'main_uid', 'name', 'corp_id', 'group_id', 'robot_ids', 'send_interval', 'contact_data', 'send_content', 'send_time_type', 'send_time', 'send_time_config', 'comments', 'timing_delete_switch', 'timing_delete_hour', 'is_cust_dedup', 'status', 'publish_time', 'exception_data', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'main_uid' => 'integer', 'corp_id' => 'integer', 'group_id' => 'integer', 'robot_ids' => 'array', 'send_interval' => 'integer', 'contact_data' => 'array', 'send_content' => 'array', 'send_time_type' => 'integer', 'send_time' => 'integer', 'send_time_config' => 'array', 'comments' => 'array', 'timing_delete_switch' => 'integer', 'timing_delete_hour' => 'decimal:2', 'is_cust_dedup' => 'integer', 'status' => 'integer', 'publish_time' => 'integer', 'exception_data' => 'array', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function user()
    {
        return $this->hasOne(ChUser::class,'id','uid');
    }

    public function group()
    {
        return $this->hasOne(ChFriendCircleTaskGroup::class,'id','group_id');
    }
}
